package com.rqf.ls.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.rqf.common.base.ProjectInfor;
import com.rqf.ls.service.IManagementUserService;
import com.server.web.SessionUtil;

@Controller
@RequestMapping("")
public class IndexController {

	@Autowired
	private IManagementUserService userManagementService;

	@RequestMapping("")
	public ModelAndView index(HttpServletRequest request) {
		ModelAndView mv = null;
		// 验证管理员权限
		String userName = SessionUtil.getStringAttri(request, "userName");
		String password = SessionUtil.getStringAttri(request, "password");
		Boolean vertified = userManagementService.verifySession(userName,
				password);
		if (vertified) {
			mv = new ModelAndView("manager/managerIndex");
		}else {
			mv = new ModelAndView("manager/login");
		}
		mv.addObject("rootPath",ProjectInfor.ROOT_PATH);
		return mv;
	}

}